package com.peiqi.aiproject.controller;


import cn.hutool.http.HttpStatus;
import com.peiqi.aiproject.domain.IdeaToolData;
import com.peiqi.aiproject.domain.Tags;
import com.peiqi.aiproject.domain.vo.ResponseVO;
import com.peiqi.aiproject.service.IdeaToolDataService;
import com.peiqi.aiproject.service.TagsService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.peiqi.aiproject.domain.vo.ResponseVO.success;

/**
 *
 * 热门灵感标签接口
 * @author yulian
 */
@RestController
@RequestMapping("/api/tags")

public class TagsController {

    @Resource
    private TagsService tagsService;

    /**
     * 查询灵感创意数据
     *
     * @return 返回一个包含所有IdeaToolData的列表的ResponseVO对象
     */
    @GetMapping
    public ResponseVO<List<Tags>> findAll() {
        return success(HttpStatus.HTTP_OK, tagsService.findAll());
    }

    /**
     * 根据提供的ID查询特定的创意数据
     *
     * @param id 数据的唯一标识符
     * @return 返回一个包含指定IdeaToolData的ResponseVO对象
     */
    @GetMapping("/{id}")
    public ResponseVO<Tags> findById(@PathVariable int id) {
        return success(HttpStatus.HTTP_OK, tagsService.findById(id));
    }
}
